package com.logistics.material.entity.model;

import com.logistics.erp.entity.domain.ErpInvReq;
import com.logistics.material.entity.domain.Material;
import com.logistics.utils.tool.DateUtils;
import com.logistics.utils.tool.StringUtils;
import lombok.Data;

@Data
public class MaterialRow {

    private String pickId;

    private String stationCode;

    private String erpInvBillCode;

    private String container;

    private String itemCode;

    private String itemName;

    private String wcName;

    private String wcCode;

    private String itemWorkCode;

    private String itemUnit;

    private String itemQty;

    private String seqNo;

    private String endLocationCode;

    private String endLocationName;

    private String nextStartDate;

    public MaterialRow(){}

    public MaterialRow(Material material){
        this.pickId = material.getPickId();
        this.stationCode = material.getStationCode();
        this.erpInvBillCode = material.getErpInvBillCode();
        this.container = material.getContainer();
        this.itemCode = material.getItemCode();
        this.itemName = material.getItemName();
        this.wcName = material.getWcName();
        this.wcCode = material.getWcCode();
        this.itemWorkCode = material.getItemWorkCode();
        this.itemUnit = material.getItemUnit();
        this.itemQty = material.getItemQty();
        this.seqNo = material.getSeqNo();
        this.endLocationCode = material.getEndLocationCode();
        this.endLocationName = material.getEndLocationName();
        this.nextStartDate = DateUtils.dateToStringFormat(material.getNextStartDate(), DateUtils.YYYY_MM_DD_HH_MM_DD_SLASH);
    }

    public static MaterialRow build(Material material){
        return new MaterialRow(material);
    }

    public MaterialRow(ErpInvReq erpInvReq){
        this.itemCode = erpInvReq.getItemCode();
        this.itemName = erpInvReq.getItemName();
        this.seqNo = erpInvReq.getSeqNo();
        this.itemUnit = erpInvReq.getStockUnitName();
        this.itemQty = erpInvReq.getReqQty().toString();
        this.itemWorkCode = erpInvReq.getTaskCode();
    }
    public static MaterialRow build(ErpInvReq erpInvReq){
        return new MaterialRow(erpInvReq);
    }
}
